package edu.Ding.A0419;
//模拟出租车，假设出租车起步价2公里内8元，超过2公里的按每公里1.5元
// 收费，将起步价设为静态变量，根据输入的里程数，计算乘车费用
import java.util.Scanner;

public class Demo1 {
    public static double price(double me){
        double sum;
        sum =(double) 8 + 1.5*(me-2);
        return sum;
    }

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        System.out.println("请输入里程数：");
        double me = scan.nextDouble();
        double a = 2;
        if(me<=a){
            System.out.println("费用为8元");
        }else{
            System.out.println("费用为"+price(me)+"元");
        }
    }
}
